﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Aj.Core;

public partial class news_info : PageBase
{
    protected int id;
    protected int cid;
    protected string title;

    protected DataSet ds = null;
    protected DataSet preDs = null;
    protected DataSet nextDs = null;

    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        id = QueryParamInt32("id");
        try
        {
            if (id > 0)
            {
                ds = CustomQuery.Article_GetArticleById(id);
                if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    title = ds.Tables[0].Rows[0]["A_Title"].ToString();
                    cid = ds.Tables[0].Rows[0]["A_Cateid"].ToInt();

                    preDs = CustomQuery.Article_GetPreArticleById(cid, id);
                    nextDs = CustomQuery.Article_GetNextArticleById(cid, id);

                    CustomQuery.Article_ViewClick(id);
                }
                else
                {
                    Page_GoTo("news.html", true);
                }
            }
            else
            {
                Page_GoTo("news.html", true);
            }
        }
        catch (Exception ex)
        {
            Utility.WriteErrorLog("news_info", ex);
        }
    }
}